package com.example.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class OssConfig {
    @Bean
    @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public OSS ossClient(){
        // Endpoint以成都为例。
        //创建对象存储的域名
        String endpoint = "oss-cn-beijing.aliyuncs.com";
        //验证码获取的accessKeyId
        String accessKeyId = "LTAI5t5akTW4ZEKesJwtXWmo";
        //验证码获取的accessKeySecret
        String accessKeySecret = "sPMLTzcWqDxm061g6iN73R9kEX52vU";
        // 创建OSSClient实例。
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);

    }
}
